<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<style>
    .upload{
        padding: 4px 10px;
        height: 20px;
        line-height: 20px;
        position: relative;
        border: 1px solid #999;
        text-decoration: none;
        color: #666;
    }
    .change{
        position: absolute;
        overflow: hidden;
        right: 0;
        top: 0;
        opacity: 0;
    }
</style>


<a href="javascript:;" class="upload">选择文件
    <input class="change" type="file" multiple="multiple" />
</a>
    <a href="javascript:;" id="btn">'点击'</a>
    <script>
        $('#btn').click(function () {
            submitData();
        })
        function submitData() {
            var stringJson =
                '{"name":"geely2","password":"1234","role":0,"age":44,"wx":"geely2","phone":13988954321,"email":"geely2@qq.com"}';
            $.ajax({
                type: 'post',
                url: '/staff/save',
                async: false,
//                data: JSON.parse(stringJson),
                data: stringJson,
                contentType: "application/json; charset=utf-8",
                dataType: 'json',
                success: function (result) {
                    if(result.status == 0){
                        var data = result.data;
                        console.log(result.data);
                        $('#staffInfo').html('id:'+data.id+' name:'+data.name);
                    }else{
                        alert(result.msg);
                    }

                },
                error:function (result) {
                    console.log(result);
                    alert(result.status);
                }
            });
        }
    </script>
    <div id="staffInfo"></div>
</body>
</html>